/*
** my_getnbr.c for colle in /home/boulah_m//colle
** 
** Made by moustafa boulahia
** Login   <boulah_m@epitech.net>
** 
** Started on  Sat Oct 15 21:43:44 2011 moustafa boulahia
** Last update Mon Jan 23 08:05:30 2012 moustafa boulahia
*/

int	my_get_nbr(char *str)
{
  int	pos;
  int	signe;
  int	nbr;

  pos = 0;
  signe = 1;
  while (str[pos] != '\0' && (str[pos] == '+' || str[pos] =='-'))
    {
      if (str[pos] == '-')
	{
	  signe = signe * (-1);
	}
      pos = pos + 1;
    }
  str = str + pos;
  pos = 0;
  nbr = 0;
  while (str[pos] >= '0' && str[pos] <= '9')
    {
      nbr = nbr * 10;
      nbr = nbr - (str[pos] - '0');
      pos = pos + 1;
    }
  return (nbr * signe * (-1));
}
